import 'package:yt_devops/model/device_model.dart';
import 'package:yt_devops/model/install_provider_model.dart';
import 'package:yt_devops/model/user_model.dart';
import 'package:yt_devops/pages/devices/device_list/device_list_model.dart';
import 'package:yt_devops/pages/devices/device_tab/basic_info/base/base_basic_model.dart';
import 'package:yt_devops/pages/site/site_list/site_list_model.dart';

class CustomRuntimeTypeConvert {
  static Type getGenericType(M) {
    String runtimeType = M.toString();
    String genericType = runtimeType.substring(
        runtimeType.indexOf("<") + 1, runtimeType.length - 1);
    if ((UserModel).toString() == genericType) {
      return UserModel;
    } else if ((InstallProviderModel).toString() == genericType) {
      return InstallProviderModel;
    } else if ((DeviceModel).toString() == genericType) {
      return DeviceModel;
    } else if ((DeviceListModel).toString() == genericType) {
      return DeviceListModel;
    } else if ((SiteModel).toString() == genericType) {
      return SiteModel;
    }

    return dynamic;
  }
}
